package com.zhudeshuai.zhudemolist.activity;

import android.os.Bundle;
import android.os.Handler;
import android.view.View;

import com.zhu.zhuCore.widget.LoadingAnimationView;
import com.zhudeshuai.zhudemolist.R;
import com.zhudeshuai.zhudemolist.base.BaseActivity;
import com.zhudeshuai.zhudemolist.widget.LoadingProgressDialog;

/**
 * 优化控件LoadingProgressDialog
 *
 * @author zhudeshuai
 * @since 17/12/14
 */
public class LoadingProgressActivity extends BaseActivity {

	private LoadingProgressDialog mDialog;
	private Handler mHandler = new Handler();
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_loading_progress);
		mDialog = new LoadingProgressDialog(this);
		mDialog.setMessage("测试文字测试文字测试文字测试文字测试文字测试文字测试文字测试文字");
		mDialog.setLoadFinishListener(new LoadingAnimationView.LoadingAnimationViewListener() {
			@Override
			public void onAnimStop(int type) {
				mDialog.dismiss();
			}
		});
	}

	public void show(View view) {
		mDialog.show(LoadingProgressDialog.Status.LOADING);
		mHandler.postDelayed(new Runnable() {
			@Override
			public void run() {
				mDialog.show(LoadingProgressDialog.Status.SUCCESS);
			}
		},2000);
	}
}
